package com.dragon.common.base.exceptions;

/**
 * @author Chris Chan
 * Create On 2025/7/28 下午6:52
 * Use for:
 * Explain:
 */
public class CommonException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    private int code;

    public CommonException(String message) {
        super(message);
    }

    public CommonException(int code, String message) {
        super(message);
        this.code = code;
    }

    public CommonException(String message, Throwable cause) {
        super(message, cause);
    }

    public CommonException(Throwable cause) {
        super(cause);
    }

    public static CommonException create(String message) {
        return new CommonException(message);
    }

    public static CommonException create(int code, String message) {
        return new CommonException(code, message);
    }

    public static CommonException create(Throwable cause) {
        return new CommonException(cause);
    }

    public static CommonException of(String message) {
        return new CommonException(message);
    }

    public static CommonException of(int code, String message) {
        return new CommonException(code, message);
    }

    public int getCode() {
        return code;
    }
}
